﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data.SqlClient;
using System.Data;

/// <summary>
/// Summary description for LoaiTin
/// </summary>
public class LoaiTin
{
        SqlCommand cmd;
    SqlDataReader dr;
	
	public LoaiTin()
	{
		//
		// TODO: Add constructor logic here
		//
	}

    public List<ObjLoaiTin> getLoaiTinAll()
    {
        string constr = System.Configuration.ConfigurationManager.ConnectionStrings["conStr"].ConnectionString;
        SqlConnection sqlConnection = new SqlConnection(constr);

        sqlConnection.Open();
        cmd = new SqlCommand("sp_LoaiTinGetAll", sqlConnection);
        cmd.CommandType = CommandType.StoredProcedure;
        dr = cmd.ExecuteReader();
        ObjLoaiTin objLoaiTin;
        List<ObjLoaiTin> lst = new List<ObjLoaiTin>();
        while (dr.Read())
        {
            objLoaiTin = new ObjLoaiTin();
            objLoaiTin.Loai_tin_id = dr["loai_tin_id"].ToString();
            objLoaiTin.Ten_loai_tin = dr["ten_loai_tin"].ToString();
            lst.Add(objLoaiTin);

        }
        return lst;
        sqlConnection.Close();
    }
}